import greenfoot.*;

/**
 * This class defines a crab. Crabs live on the beach.
 */
public class Crab extends Actor
{
    public void act()
    {
       move(3);
       turnAtEdge();
       keyControl();
       removeTouching(lobster.class);
    }
    public void turnAtEdge() {
      if(isAtEdge()){
         turn(15);
      }
    }
    public void keyControl(){
      if(Greenfoot.isKeyDown("left")) {
         turn(-25);
      }
      if(Greenfoot.isKeyDown("right")) {
         turn(25);
      }
    }
}
   